from django.contrib import admin
from .models import BookInfo, HeroInfo


class HeroInfoInLine(admin.TabularInline):
    model = HeroInfo
    extra = 2


class BookInfoAdmin(admin.ModelAdmin):
    list_display = ['id', 'btitle', 'bpub_date', 'bcommet', 'bread', 'isDelete']
    list_filter = ['btitle']
    search_fields = ['btitle']
    list_per_page = 10
    fieldsets = [
        ("基础", {'fields': ['btitle']}),
        ("高级", {'fields': ['bpub_date']})

    ]
    inlines = [HeroInfoInLine]


class HeroInfoAdmin(admin.ModelAdmin):
    list_display = ['id', 'hname', 'gender', 'hcontent', 'hBook']
    fieldsets = [
        ("基础", {'fields': ['hname', 'hgender']}),
        ("高级", {'fields': ['hcontent', 'hBook']})

    ]


# Register your models here.
admin.site.register(BookInfo, BookInfoAdmin)

admin.site.register(HeroInfo, HeroInfoAdmin)
